home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-05-17 | 23.0 KB | 718 lines | [TEXT/MPS ] |
- /*
- File: HWSpecific.c
-
- Contains: This file contains the routine(s) that are hardware specific for the
- DLPI. Each vendor must supply code that works with their own
- card.
-
- Written by:
-
- Copyright: © 1994, 1996-1997 by Apple Computer, Inc., all rights reserved.
-
- Change History (most recent first):
-
- <FW14> 3/14/97 ES Changed specID to Apple's vendor unique ID of 0x00A040.
- <FW13> 1/16/97 ES Changed to invalidate CSRROMEntryID's before using and to
- deallocate them when we're done.
- <FW12> 1/9/97 ES Took out some debugging stuff. Removed fixed address allocation.
- <FW11> 12/27/96 ES Changed a bunch of "FWDriver"s to "FWClient"s. Changed to
- protocol driver.
- <FW10> 12/16/96 ES Changed to work with new read/write/lock request/complete
- processing mechanism.
- <FW9> 12/3/96 ES Added kFWFixedAddress flag to FWAllocateAddressSpace.
- <FW8> 9/27/96 ES Changed to use set driver interface calls rather than driver
- interface table.
- <FW7> 9/3/96 ES Added line to nil out reset notification proc in driver
- interface table.
- <FW6> 8/29/96 ES Changed FWRegisterDriver to take driver interface proc table.
- <FW5> 8/26/96 ES Changed to new command object interface.
- <FW4> 8/1/96 ES Took out unused local variables.
- <FW3> 4/17/96 ES Changed call to FWRegisterDriver.
- <FW2> 4/15/96 ES Update for use with Driver Notification services. Call
- FWRegisterDriver instead of OTFindPort to get fwDriverID.
- <FW1> 3/27/96 ES first checked in
-
- To Do:
- */
-
- //-----------------------------------------------------------------------------------------
- // Header files
- //-----------------------------------------------------------------------------------------
-
- #include <OpenTptModule.h> // Open Transport files
- #include <OpenTptDevLinks.h>
-
- #include <Interrupts.h> // System files
- #include <PCI.h>
- #include <Kernel.h>
- #include <OSUtils.h>
- #include <DriverServices.h>
-
- #include "DLPIRoutines.h"
- #include "HWSpecific.h"
- #include "EntryPoints.h"
- /*zzz*/
- static char debugStr[256];
- /*zzz*/
-
- static OSStatus ABCVendorCreatePDriverUnitDirectory (
- FWPDriverID fwPDriverID,
- CSRROMEntryID *pFWPDriverCSRROMUnitDirID);
-
- void ABCVendorTransmitQueuedPacket (void);
-
- //-----------------------------------------------------------------------------------------
- // Global variable for the entire CFM
- //-----------------------------------------------------------------------------------------
-
- extern DLPIPrivateData *gDLPIPrivateData; // Declared in EntryPoints.c
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine enables our interrupts based on a parameter passed in. Code should
- // be added to this routine that enables the various interrupt bits on the card.
- // The enable and disable routines are used by the queue routines to protect
- // critical code sections. Instead of masking all interrupts we just select
- // the appropriate ones for our card.
- //
- // Input:
- // whichIntsOn - turn which interrupts on transmit, receive, or none
- //
- // Output:
- // NONE
- //
- //-----------------------------------------------------------------------------------------
- void ABCVendorEnableInterrupts(UInt16 whichIntsOn)
- {
-
- switch (whichIntsOn)
- {
- case kTxInterrupts:
- // turn on tx interrupts
- gDLPIPrivateData->txInterruptsOn = 1;
- break;
- case kRxInterrupts:
- // turn on rx interrupts
- gDLPIPrivateData->rxInterruptsOn = 1;
- break;
- case kBothTxRxInterrupts:
- // turn on both interrupts
- gDLPIPrivateData->rxInterruptsOn = 1;
- gDLPIPrivateData->txInterruptsOn = 1;
- break;
- default:
- break;
- }
-
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine disables our interrupts based on a parameter passed in.Code should
- // be added to this routine that disables the various interrupt bits on the card.
- // The enable and disable routines are used by the queue routines to protect
- // critical code sections. Instead of masking all interrupts we just select
- // the appropriate ones for our card.
- //
- // Input:
- // whichIntsOff - turn which interrupts off transmit, receive, or none
- //
- // Output:
- // NONE
- //
- //-----------------------------------------------------------------------------------------
- void ABCVendorDisableInterrupts(UInt16 whichIntsOff)
- {
-
- switch (whichIntsOff)
- {
- case kTxInterrupts:
- // turn off tx interrupts
- gDLPIPrivateData->txInterruptsOn = 0;
- break;
- case kRxInterrupts:
- // turn off rx interrupts
- gDLPIPrivateData->rxInterruptsOn = 0;
- break;
- case kBothTxRxInterrupts:
- // turn off both interrupts
- gDLPIPrivateData->rxInterruptsOn = 0;
- gDLPIPrivateData->txInterruptsOn = 0;
- break;
- default:
- break;
- }
-
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine should determine if the card pointed to by theID can be used
- // by this driver. Before we can talk to the card, the card must be enabled. To
- // enable the card use the Expansion Manager calls to "set" the appropriate
- // address space bit for your card.
- //
- // Always turn off the card after the test has been made. Just because this routine
- // is executed, it does not mean that the card is going to be used by the system.
- //
- // Input:
- // theID - NameRegistry ID of our pci card
- // resgisterSetAddress - base address of our pci card
- //
- // Output:
- // returns true, if driver can work with the card
- // returns false, if driver cannot work with the card
- //
- //-----------------------------------------------------------------------------------------
- Boolean ABCVendorIsThisOurCard(RegEntryID *theID, UInt32 resgisterSetAddress)
- {
- return kTrue;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine should set the physical address in the ethernet hw. On initialization
- // we may have read our physical address out of a EPROM, but now somebody is
- // explicitly telling us to change our address. Update in globals.
- //
- // Input:
- // physicalAddress - multicast address (array of 6 bytes)
- //
- // Output:
- // returns no error
- //
- //-----------------------------------------------------------------------------------------
- SInt32 ABCVendorSetEthernetAddress(UInt8 *physicalAddress)
- {
-
- /*zzz*/
- DebugStr1 ((ConstStr255Param) "\pABCVendorSetEthernetAddress");
- /*zzz*/
- OTCopy48BitAddress(physicalAddress,&gDLPIPrivateData->ourEAddress);
-
- return kOTNoError;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine retrieves the factory ethernet address. This is not the same
- // as the current ethernet physical address (ourEAddress).
- //
- // Input:
- // addressArray - address to place the factory ethernet address bytes
- //
- // Output:
- // NONE
- //
- //-----------------------------------------------------------------------------------------
- void ABCVendorGetFactoryEthernetAddress(UInt8 *addressArray)
- {
- UInt32 *pAddress;
-
- /*zzz*/
- DebugStr1 ((ConstStr255Param) "\pABCVendorGetFactoryEthernetAddress");
- /*zzz*/
- pAddress = (UInt32 *) addressArray;
- *pAddress = (UInt32) gDLPIPrivateData;
- addressArray[4] = 0;
- addressArray[5] = 0;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine enables the hardware to receive a new multicast address. The
- // address has already been verified that it is a multicast address. Another
- // check was made before this routine was called that this address is not a
- // duplicate. All that needs to be done at this point is manipulate the hardware
- // so that it will start receiving packets whose destination is the address.
- //
- // Input:
- // newMulticastAddr - multicast address (array of 6 bytes)
- //
- // Output:
- // returns no error
- //
- //-----------------------------------------------------------------------------------------
- SInt32 ABCVendorRegisterMulticast(UInt8 *newMulticastAddr)
- {
-
- return kOTNoError;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine manipulates the hardware in order to not receive the multicast
- // address. The address was check to see if it had been registered previously.
- // All that needs to be done at this point is manipulate the hardware
- // so that it will stop receiving packets whose destination is the address.
- //
- // Input:
- // oldMulticastAddr - multicast address (array of 6 bytes)
- //
- // Output:
- // returns no error
- //
- //-----------------------------------------------------------------------------------------
- SInt32 ABCVendorUnregisterMulticast(UInt8 *oldMulticastAddr)
- {
-
- return kOTNoError;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine communicates with the transmitter to send the packet described in
- // the message block thePacket. If for some unknown reason you cannot send
- // the packet then drop the packet on the floor.
- //
- // Code in this routine demonstrates how to extract the packet data from the
- // message. This is just a sample, change to fit your hardware. It is currently
- // commented out since the dma memory ptr is not defined.
- //
- // Input:
- // packetSize - byte count of the packet
- // thePacket - message block that describes the packet to transmit
- //
- // Output:
- // NONE
- //
- //-----------------------------------------------------------------------------------------
- void ABCVendorTransmitOnePacket(mblk_t *thePacket, UInt16 packetSize)
- {
- QHdrPtr transmitPacketQueue = gDLPIPrivateData->transmitPacketQueue;
- DLPITransmitPacketCommandPtr pDLPITransmitPacketCommand;
- Ptr transmitBuffer, transmitBufferStorage;
- UInt32 copySize;
- Boolean busy = true;
-
- transmitBufferStorage = OTAllocMem (packetSize);
- transmitBuffer = transmitBufferStorage;
- if (transmitBuffer != NULL)
- {
- while (thePacket)
- {
- copySize = thePacket->b_wptr - thePacket->b_rptr;
-
- bcopy((Ptr)thePacket->b_rptr, transmitBuffer, copySize);
-
- transmitBuffer += copySize;
-
- thePacket = thePacket->b_cont;
-
- }
-
- pDLPITransmitPacketCommand = OTAllocMem (sizeof (DLPITransmitPacketCommand));
- if (pDLPITransmitPacketCommand != NULL)
- {
- if (TestAndSet (0, (UInt8 *) &(transmitPacketQueue->qFlags)))
- busy = true;
- else
- busy = false;
-
- pDLPITransmitPacketCommand->transmitBuffer = transmitBufferStorage;
- pDLPITransmitPacketCommand->packetSize = packetSize;
- PBEnqueueLast ((QElemPtr) pDLPITransmitPacketCommand, transmitPacketQueue);
- }
- else
- {
- packetSize = 0;
- }
- }
- else
- {
- packetSize = 0;
- }
-
- if (!busy)
- ABCVendorTransmitQueuedPacket ();
-
- }
-
- void ABCVendorTransmitQueuedPacket (void)
- {
- QHdrPtr transmitPacketQueue = gDLPIPrivateData->transmitPacketQueue;
- DLPITransmitPacketCommandPtr pDLPITransmitPacketCommand;
- FWCommandObjectID asynchCommandObjectID;
- Ptr transmitBuffer;
- UInt32 packetSize;
- UInt32 packetCount = 0;
-
- pDLPITransmitPacketCommand = (DLPITransmitPacketCommandPtr) transmitPacketQueue->qHead;
- transmitBuffer = pDLPITransmitPacketCommand->transmitBuffer;
- packetSize = pDLPITransmitPacketCommand->packetSize;
- asynchCommandObjectID = gDLPIPrivateData->asynchCommandObjectID;
- if (asynchCommandObjectID == kInvalidFWCommandObjectID)
- {
- ABCVendorTransmitCompletion (asynchCommandObjectID, noErr, (UInt32) pDLPITransmitPacketCommand);
- return;
- }
-
- if (packetSize > 0)
- {
- OTEnterInterrupt ();
-
- {
- FWSetFWCommandCompletionProcData (asynchCommandObjectID,
- (UInt32) pDLPITransmitPacketCommand);
- FWSetCommonAsynchCommandParams (asynchCommandObjectID,
- gDLPIPrivateData->targetAddress.addressHi,
- gDLPIPrivateData->targetAddress.addressLo,
- transmitBuffer,
- packetSize);
-
- FWWrite (asynchCommandObjectID);
- }
-
- OTLeaveInterrupt ();
- }
- }
-
- void ABCVendorTransmitCompletion(
- FWCommandObjectID fwCommandObjectID,
- OSStatus commandStatus,
- UInt32 completionProcData)
- {
- DLPITransmitPacketCommandPtr pDLPITransmitPacketCommand;
- QHdrPtr transmitPacketQueue = gDLPIPrivateData->transmitPacketQueue;
- Boolean busy = true;
-
- OTEnterInterrupt(); // open transport needs to be notified when entering an interrupt
- pDLPITransmitPacketCommand = (DLPITransmitPacketCommandPtr) completionProcData;
-
- // for the transmitter
- // is a packet waiting to be sent, then queue the deferred task
- if (gDLPIPrivateData->TxPacketQueue.qHead)
- OTScheduleDeferredTask(gDLPIPrivateData->TxDeferredTaskCookie);
-
- PBDequeue ((QElemPtr) pDLPITransmitPacketCommand, transmitPacketQueue);
-
- OTFreeMem ((Ptr) pDLPITransmitPacketCommand->transmitBuffer);
- OTFreeMem ((Ptr) pDLPITransmitPacketCommand);
-
- OTLeaveInterrupt(); // open transport needs to be notified when leaving an interrupt
-
- transmitPacketQueue->qFlags = 0;
-
- if (transmitPacketQueue->qHead != NULL)
- {
- if (TestAndSet (0, (UInt8 *) &(transmitPacketQueue->qFlags)))
- busy = true;
- else
- busy = false;
- }
-
- if (!busy)
- ABCVendorTransmitQueuedPacket ();
-
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine needs to check the transmitter hw to determine if it can send
- // a packet with a size of packetSize.
- //
- // Input:
- // packetSize - byte count of the packet
- //
- // Output:
- // kOTNoError, if the transmitter hw can handle the packet
- // nonzero, if the transmitter hw cannot handle the packet
- //
- //-----------------------------------------------------------------------------------------
- OSErr ABCVendorCheckTransmitterStatus(UInt16 packetSize)
- {
-
- if (packetSize > kMaxTransmitSize)
- return (-1);
- else
- return kOTNoError;
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine first trys to allocate memory for our gDLPIPrivateData.The
- // hardware should then be initialized. One of the things during the hw initialization
- // that should be done is to read in our Ethernet address.
- // The gDLPIPrivateData global is set in this routine.
- //
- // Input:
- // RegEntryID - NameRegistry ID for our PCI card
- //
- // Output:
- // gDLPIPrivateData, NULL if initialization was not successfull
- // !NULL, if initialization was successfull
- //
- //-----------------------------------------------------------------------------------------
-
- void ABCVendorInitialize(RegEntryID *theID)
- {
- FWPDriverProtocol fwPDriverProtocolTable[1];
- CSRROMEntryID csrROMUnitDirID;
- Ptr transmitBuffer;
- Ptr receiveBuffer;
- FWAddressSpaceID fwAddressSpaceID;
-
- /*zzz*/
- DebugStr1 ((ConstStr255Param) "\pABCVendorInitialize");
- /*zzz*/
- // allocate memory, do not use OT memory unless we need to, OT memory
- // allocation is interrupt safe so lets not waste it when we can use PoolAlocateResident.
- // Thanks to a developer in Sweden for pointing this out!
- gDLPIPrivateData = (DLPIPrivateData *)PoolAllocateResident( sizeof(DLPIPrivateData),kTrue );
- if (gDLPIPrivateData == NULL)
- return;
- transmitBuffer = PoolAllocateResident (kMaxTransmitSize, false);
- if (transmitBuffer == NULL)
- {
- PoolDeallocate ((Ptr) gDLPIPrivateData);
- gDLPIPrivateData = NULL;
- return;
- }
- gDLPIPrivateData->transmitBuffer = transmitBuffer;
- receiveBuffer = PoolAllocateResident (kMaxTransmitSize, false);
- if (receiveBuffer == NULL)
- {
- PoolDeallocate ((Ptr) transmitBuffer);
- PoolDeallocate ((Ptr) gDLPIPrivateData);
- gDLPIPrivateData = NULL;
- return;
- }
- gDLPIPrivateData->receiveBuffer = receiveBuffer;
-
- *(&gDLPIPrivateData->nodeEntryID) = *((RegEntryID *)theID); // copy our reg node id
-
- FWRegisterProtocolDriver (&gDLPIPrivateData->nodeEntryID, &(gDLPIPrivateData->fwPDriverID), 0);
- fwPDriverProtocolTable[0].specID = 0x00A040;//zzz use your own company ID here
- fwPDriverProtocolTable[0].swVersion = 'otn';
- FWSetPDriverProtocolTable (gDLPIPrivateData->fwPDriverID, &fwPDriverProtocolTable[0], 1);
- FWSetFWPDriverUnitAddedProc (gDLPIPrivateData->fwPDriverID, FWPDriverUnitAdded);
- FWSetFWPDriverUnitRemovedProc (gDLPIPrivateData->fwPDriverID, FWPDriverUnitRemoved);
- FWScanUnitsForFWPDriver (gDLPIPrivateData->fwPDriverID);
-
- FWAllocateAddressSpace (&fwAddressSpaceID,
- (FWReferenceID) gDLPIPrivateData->fwPDriverID,
- &(gDLPIPrivateData->localAddress),
- kMaxTransmitSize,
- gDLPIPrivateData->receiveBuffer,
- kFWAddressWriteEnable | kFWAddressWriteCompleteNotify,
- (Ptr) gDLPIPrivateData);
-
- ABCVendorCreatePDriverUnitDirectory (gDLPIPrivateData->fwPDriverID, &csrROMUnitDirID);
-
- FWCSRROMInstantiate (gDLPIPrivateData->fwPDriverID);
-
- FWSetFWClientWriteCompleteProc ((FWReferenceID) gDLPIPrivateData->fwPDriverID, FWClientWriteCompleteInterface);
-
- PBQueueCreate (&(gDLPIPrivateData->transmitPacketQueue));
-
- ABCVendorGetFactoryEthernetAddress(gDLPIPrivateData->ourEAddress);
-
-
- // initialize hardware, remember to turn on the address map bit in the Config Command Register
- // also if the card does dma then you need to turn on the dma (master) bit
-
-
- gDLPIPrivateData->TxDeferredTaskCookie = OTCreateDeferredTask(TxDTCallback,NULL);
- gDLPIPrivateData->RxDeferredTaskCookie = OTCreateDeferredTask(RxDTCallback,NULL);
-
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- //
- // ABCVendorCreatePDriverUnitDirectory
- //
- // This routine adds a Configuration ROM unit directory for the protocol driver.
- //zzz must do cleanup on error.
- //
-
- static OSStatus ABCVendorCreatePDriverUnitDirectory(
- FWPDriverID fwPDriverID,
- CSRROMEntryID *pFWPDriverCSRROMUnitDirID)
- {
- CSRROMEntryID csrROMRootEntryID = kInvalidCSRROMEntryID,
- csrROMUnitDirEntryID = kInvalidCSRROMEntryID,
- csrROMEntryID = kInvalidCSRROMEntryID;
- UInt32 immediateEntry;
- OSStatus status = noErr;
-
- // Get configuration ROM root directory.
- status = FWCSRROMGetRootDirectory (fwPDriverID, &csrROMRootEntryID);
-
- // Create a new unit directory.
- if (status == noErr)
- {
- status = FWCSRROMCreateEntry (csrROMRootEntryID,
- &csrROMUnitDirEntryID,
- kDirectoryCSRROMEntryType,
- kCSRUnitDirectoryKey,
- nil,
- 0);
- }
-
- // Set unit's spec ID.
- if (status == noErr)
- {
- immediateEntry = 0x00A040 << 8;//zzz use your own company ID here
- status = FWCSRROMCreateEntry (csrROMUnitDirEntryID,
- &csrROMEntryID,
- kImmediateCSRROMEntryType,
- kCSRUnitSpecIdKey,
- (Ptr) &immediateEntry,
- 3);
- }
-
- // Set unit's SW Version.
- if (status == noErr)
- {
- immediateEntry = 'otn ';
- status = FWCSRROMCreateEntry (csrROMUnitDirEntryID,
- &csrROMEntryID,
- kImmediateCSRROMEntryType,
- kCSRUnitSwVersionKey,
- (Ptr) &immediateEntry,
- 3);
- }
-
- // Create unit dependent leaf.
- if (status == noErr)
- {
- // Create the leaf containing our local write address.
- status = FWCSRROMCreateEntry (csrROMUnitDirEntryID,
- &csrROMEntryID,
- kLeafCSRROMEntryType,
- kCSRUnitDependentInfoKey,
- (Ptr) &(gDLPIPrivateData->localAddress),
- sizeof (FWAddress));
- }
-
- // Clean up.
- if (csrROMRootEntryID != kInvalidCSRROMEntryID)
- FWCSRROMDisposeEntryID (csrROMRootEntryID);
-
- if (csrROMEntryID != kInvalidCSRROMEntryID)
- FWCSRROMDisposeEntryID (csrROMEntryID);
-
- // Return unit directory ID.
- if (status == noErr)
- *pFWPDriverCSRROMUnitDirID = csrROMUnitDirEntryID;
- else
- *pFWPDriverCSRROMUnitDirID = kInvalidCSRROMEntryID;
-
- return (status);
- }
-
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine closes down the hardware. The memory is also deallocated.
- // This routine undoes everything done in the initialize routine.
- //
- // Input:
- // NONE
- //
- // Output:
- // NONE
- //
- //-----------------------------------------------------------------------------------------
-
- void ABCVendorClose(void)
- {
- mblk_t *thePacket;
-
- // turn off hardware
-
- OTDestroyDeferredTask(gDLPIPrivateData->TxDeferredTaskCookie);
- OTDestroyDeferredTask(gDLPIPrivateData->RxDeferredTaskCookie);
-
-
- // clear out the tx and rx dlpi private queues
- while ((thePacket = (mblk_t *) DequeueHead(&gDLPIPrivateData->RxPacketQueue, kNoInterrupts))
- != NULL)
- freemsg(thePacket);
-
- while ((thePacket = (mblk_t *) DequeueHead(&gDLPIPrivateData->TxPacketQueue, kNoInterrupts))
- != NULL)
- freemsg(thePacket);
-
- // deallocate memory, must use same routine pair as the allocate
- PoolDeallocate(gDLPIPrivateData);
- gDLPIPrivateData = NULL;
-
- }
-
- //-----------------------------------------------------------------------------------------
- // Description:
- // This routine is the interrupt service routine for our card. Do necessary
- // stuff in isr then defer for a later time the bulk of the work. In the isr
- // you need to notify Open Transport that we are in an isr. The next step
- // is to clear whatever hw bit you need to in order to deassert the interrupt line.
- //
- // For the transmitter...
- // Since the transmitter isr section normally is called after a packet
- // has been transmitted or some error occurs. You need to cleanup anything
- // related to the packet transmission (collect statistics, ...) and then
- // check the TxPacketQueue to see if you have any packets waiting to
- // be sent. If there are packets then schedule the deferred task and when
- // the callback occurs it will try to send any packet waiting on the queue.
- //
- // For the receiver...
- // If this section is called then you need to collect the packet and place
- // it in a message block. The message block can then be placed on the
- // RxPacketQueue. The callback routine which is called after scheduling the
- // deferred task will check the RxPacketQueue and send all packets on the
- // queue to the appropriate stream.
- //
- // Input:
- // member - contains information about the pci interrupt member
- // refCon - this value was passed in during the installation of the isr, since
- // we have globals we do not need to use this
- //
- // Output:
- // return kIsrIsComplete always
- //
- //-----------------------------------------------------------------------------------------
-
- InterruptMemberNumber ABCVendorISR(InterruptSetMember member, void *refCon, UInt32 theIntCount)
- {
-
- OTEnterInterrupt(); // open transport needs to be notified when entering an interrupt
-
- // clear the bit that caused the interrupt
-
-
- // for the transmitter
- // is a packet waiting to be sent, then queue the deferred task
- if (gDLPIPrivateData->TxPacketQueue.qHead)
- OTScheduleDeferredTask(gDLPIPrivateData->TxDeferredTaskCookie);
-
-
- // for the receiver check if anything has come in
- // copy packet from hw into a message block then pass it on
-
- //if ((thePacket = allocb(the packet size), BPRI_HI))
- // {
-
- // copy packet into message block
- // bcopy(DMAPtrToPacket, thePacket->b_rptr, the packet size);
- // thePacket->b_wptr += the packet size;
- // Return the dma memory to the dma engine.
-
- // or you could use esballoc or OTAllocMsg which will use the DMAPtrToPacket
- // you will then get a callback when the client is finished with the dma memory
- // Keep in mind that packets could be returned via the callback out of order,
- // your dma hw might not be compatiable with this.
- //
- // put packet on the queue so callback routine can dequeue it and
- // pass it on to upper layers
- // EnqueueElement(&gDLPIPrivateData->RxPacketQueue,(QElem *)thePacket,kNoInterrupts);
- OTScheduleDeferredTask(gDLPIPrivateData->RxDeferredTaskCookie);
-
- // }
-
-
-
- OTLeaveInterrupt(); // open transport needs to be notified when leaving an interrupt
-
- return kIsrIsComplete;
- }
-